package com.itheima.algorithm.hashtable;

import java.util.Arrays;

public class E06Leetcode242 {
    public boolean isAnagram(String s,String t){
        return Arrays.equals(getKey(s),getKey(t));
    }

    private static int[] getKey1(String s){
        int [] array=new int[26];
        for(int i=0;i<s.length();i++){
            char ch=s.charAt(i);
            array[ch-'a']++;
        }
        return  array;
    }

    private static int[] getKey(String s){
        int [] array=new int[26];
        char[] chars=s.toCharArray();
        for(char ch:chars){
            array[ch-'a']++;
        }
        return array;
    }
}
